import React from 'react'
import { Tabs,Table,Modal,Badge } from 'antd'
import moment from "moment"

const TabPane = Tabs.TabPane;
const confirm = Modal.confirm

class List extends React.Component {
	constructor(props) {
		super(props)
		
		this.state = {
			
		}
	}
	
	callback = key =>{
//		console.log(key)
	}
   async pageChange(pagination) {
//  console.log(pagination);
    await this.props.onPageChange(pagination);
    this.newPage = pagination.current;
  }	
	edit  = (record, e,text) => {
		const {showDet,showDep,onComponent,showModals} = this.props
		const params ={
			id:record.id,
		}
		const paramss = {
			parentId:record.organizationId
		}
		if(e == 1){
			showModals()
			showDet(params)
			showDep(paramss)
		}
		
	}
	editComponent = (record,e,text) =>{
//		console.log("111")
		const {showModals} = this.props
		showModals()
//		const {showDet,isFileComponent} = this.props
		//查看页面详情
//		showDet(25)
//		isFileComponent(true)
	}
	
	render(){
		const {list,pagination1,loading} = this.props
		const columns = [
	      {
	        title: "档案编号",
	        dataIndex: "number",
	        key: "number",
	      },{
	        title: "档案名称",
	        dataIndex: "title",
	        key: "title",
	      },
	      {
	        title: "档案类型",
	        dataIndex: "archivesType",
	        key: "archivesType",
	      },
	      {
	        title: "业务类型",
	        dataIndex: "businessType",
	        key: "businessType",
	      },
	      {
	        title: "状态",
	        dataIndex: "state",
	        key: "state",
	        render:(text,record) =>{
	        		return(
	        		<p>
	              {	text == 0 ? 
	              	'未归档':
	              	'已归档'
	              }
	            </p>
	        		)
	        }
	      },
	      {
	        title: "所属机构",
	        dataIndex: "organizationName",
	        key: "organizationName",
	      },
	      {
	        title: "管理人",
	        dataIndex: "createUserName",
	        key: "createUserName",
	      },
	      {
	        title: "创建日期",
	        dataIndex: "createTime",
	        key: "createTime",
	        render: (text, record) => {
	          return (
	            <p>
	              {
	                moment(record.createTime).format("YYYY-MM-DD HH:mm:ss")
	              }
	            </p>
	          );
       	 }
	      }
	      ,{
	        title: '操作',
	        dataIndex:'operation',
	        key: 'operation',
	        render:(text,record) =>{
	        		return(
	        			<div>
	        				<span onClick={this.edit.bind(null,record,1)} style={{marginRight:5}}><a href="#">移交</a></span>     				
	        			</div>
	        		)
	        }
      } 
	 ];
	 return(
			<div>
				<Table
		          columns={columns}
		          dataSource={list}
		          loading={loading}
	         	  onChange={this.pageChange.bind(this)}
	          	  pagination={pagination1}
		        />
			</div>
		)
	}
}

export default List